import java.io.*;
public class Text02{
    public static void main(String[] args) {
        System.out.println("202301110038 + 张洪健");
        Student student = new Student("张洪健", 21);
        String str = "string";


        String filePath = "student.dat";


        try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath))) {
            oos.writeObject(student);
            oos.writeObject(str);
            System.out.println("项目已经被序列化处理为" + filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }

        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath))) {
            Student deserializedStudent = (Student) ois.readObject();
            String deserializedStr = (String) ois.readObject();

            System.out.println(deserializedStudent);
            System.out.println(deserializedStr);
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}